package com.puzzlebazar.client.heyawake;

import com.puzzlebazar.client.puzzle.model.Move;
import com.puzzlebazar.client.puzzle.model.MoveVisitor;
import com.puzzlebazar.client.puzzle.model.PuzzleModel;

public class MoveRemoveRoom extends MoveRoom {


	/**
	 * 
	 */
	private static final long serialVersionUID = 6470369503577739505L;
	
	/**
	 * Only for serialization
	 */
	protected MoveRemoveRoom() {
		super();
	}
	
	/**
	 * A move that can be used to remove a new room
	 * 
	 * @param room The room to remove
	 * @param time The time of this move
	 */
	public MoveRemoveRoom(Room room, long time) {
		super(room, time);
	}
	
	@Override
	public void accept(MoveVisitor visitor) throws Exception {
		if( !(visitor instanceof HeyawakeMoveVisitor) ) 
			super.accept(visitor);
		else
			((HeyawakeMoveVisitor)visitor).visitRemoveRoomMove(this);
	}

	@Override
	public Move apply(PuzzleModel model) throws Exception {
		return deleteRoom(model);
	}

	@Override
	public Move unapply(PuzzleModel model) throws Exception {
		return createRoom(model);
	}

}
